using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.ApplicationBlocks.Data;
using System.Data.SqlClient;
using System.Configuration;

namespace DataHelper.DAL
{
    public class Comment
    {
private static  string m_trConnectionString = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;

       #region CommentSelectAll
        public static SqlDataReader CommentSelectAll(string strSearch="",int top = 1, int bottom = 20, SqlTransaction ConnectionString = null)
        {
            if (ConnectionString != null)
                return SqlHelper.ExecuteReader(ConnectionString, "CommentSelectAllRows",strSearch,top,bottom);
            return SqlHelper.ExecuteReader(m_trConnectionString, "CommentSelectAllRows",strSearch,top,bottom);
        }
        #endregion
       #region CommentSelectRow
        public static SqlDataReader CommentSelectRow(int ID, SqlTransaction ConnectionString = null)
        {
            if (ConnectionString != null)
                return SqlHelper.ExecuteReader(ConnectionString, "CommentSelectRow", ID);
            return SqlHelper.ExecuteReader(m_trConnectionString, "CommentSelectRow", ID);
        }
        #endregion
       #region CommentInsertRow
        public static void CommentInsertRow(int NewsID, int LangID, string Name, string Email, string Phone, string Address, string Comment, DateTime CreatedDate, bool IsRead, bool IsDeleted, SqlTransaction ConnectionString = null)
        {
            if (ConnectionString != null)
            {
                SqlHelper.ExecuteNonQuery(ConnectionString, "CommentInsertRow", NewsID, LangID, Name, Email, Phone, Address, Comment, CreatedDate, IsRead, IsDeleted);
                return;
            }
            SqlHelper.ExecuteNonQuery(m_trConnectionString, "CommentInsertRow", NewsID, LangID, Name, Email, Phone, Address, Comment, CreatedDate, IsRead, IsDeleted);
        }
        #endregion
       #region CommentUpdateRow
        public static void CommentUpdateRow(int ID, int NewsID, int LangID, string Name, string Email, string Phone, string Address, string Comment, DateTime CreatedDate, bool IsRead, bool IsDeleted, SqlTransaction ConnectionString = null)
        {
            if (ConnectionString != null)
            {
                SqlHelper.ExecuteNonQuery(ConnectionString, "CommentUpdateRow", ID, NewsID, LangID, Name, Email, Phone, Address, Comment, CreatedDate, IsRead, IsDeleted);
                return;
            }
            SqlHelper.ExecuteNonQuery(m_trConnectionString, "CommentUpdateRow", ID, NewsID, LangID, Name, Email, Phone, Address, Comment, CreatedDate, IsRead, IsDeleted);
        }
        #endregion
       #region CommentDeleteRow
        public static void CommentDeleteRow(int ID, SqlTransaction ConnectionString = null)
        {
            if (ConnectionString != null)
            {
                SqlHelper.ExecuteNonQuery(ConnectionString, "CommentDeleteRow", ID);
                return;
            }
            SqlHelper.ExecuteNonQuery(m_trConnectionString, "CommentDeleteRow", ID);
        }
        #endregion

    }
}

